home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Telnet / NCSA / tn3270 2.3d26 source / tn3270 / PPCToolBox.h < prev    next >
Text File  |  1991-05-26  |  8KB  |  304 lines

  1. /************************************************************
  2.  
  3. Created: Sunday, January 6, 1991 at 9:38 PM
  4.     PPCToolBox.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1989-1990
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PPCTOOLBOX__
  15. #define __PPCTOOLBOX__
  16.  
  17. #ifndef __APPLETALK__
  18. #include <AppleTalk.h>
  19. #endif
  20.  
  21. #ifndef __MEMORY__
  22. #include <Memory.h>
  23. #endif
  24.  
  25. #ifndef __TYPES__
  26. #include <Types.h>
  27. #endif
  28.  
  29. typedef short ScriptCode;            /* from MPW 3 Types.h */
  30. typedef unsigned char Str32[33];
  31.  
  32. typedef unsigned char PPCServiceType;
  33.  
  34. enum {
  35.  
  36.  
  37. /*  service Type  */
  38.     ppcServiceRealTime = 1
  39. };
  40.  
  41. typedef short PPCLocationKind;
  42.  
  43. enum {
  44.  
  45.  
  46. /* lookup Type */
  47.     ppcNoLocation = 0,                          /* There is no PPCLocName */
  48.     ppcNBPLocation = 1,                         /* Use AppleTalk NBP      */
  49.     ppcNBPTypeLocation = 2                      /* Used for specifying a location name type during PPCOpen only */
  50. };
  51.  
  52. typedef short PPCPortKinds;
  53.  
  54. enum {
  55.  
  56.  
  57. /* port Types */
  58.  
  59.     ppcByCreatorAndType = 1,                    /* PortType is specified as colloquial Mac creator and type */
  60.     ppcByString = 2                             /* Port Type is in pascal string format */
  61. };
  62.  
  63. typedef unsigned char PPCSessionOrigin;         /* Values returned for request field in PPCInform call */
  64.  
  65. enum {
  66.  
  67.  
  68. /* Values returned for requestType field in PPCInform call */
  69.     ppcLocalOrigin = 1,                         /* session originated from this machine */
  70.     ppcRemoteOrigin = 2                         /* session originated from remote machine */
  71. };
  72.  
  73. typedef short PPCPortRefNum;
  74. typedef long PPCSessRefNum;
  75.  
  76. struct PPCPortRec {
  77.     ScriptCode nameScript;                      /* script of name */
  78.     Str32 name;                                 /* name of port as seen in browser */
  79.     PPCPortKinds portKindSelector;              /* which variant */
  80.     union {
  81.         Str32 portTypeStr;                      /* pascal type string */
  82.         struct {
  83.             OSType creator;
  84.             OSType type;
  85.             } port;
  86.         } u;
  87. };
  88.  
  89. typedef struct PPCPortRec PPCPortRec;
  90. typedef PPCPortRec *PPCPortPtr;
  91.  
  92. struct LocationNameRec {
  93.     PPCLocationKind locationKindSelector;       /* which variant */
  94.     union {
  95.         EntityName nbpEntity;                   /* NBP name entity */
  96.         Str32 nbpType;                          /* just the NBP type string, for PPCOpen */
  97.         } u;
  98. };
  99.  
  100. typedef struct LocationNameRec LocationNameRec;
  101. typedef LocationNameRec *LocationNamePtr;
  102.  
  103. struct PortInfoRec {
  104.     unsigned char filler1;
  105.     Boolean authRequired;
  106.     PPCPortRec name;
  107. };
  108.  
  109. typedef struct PortInfoRec PortInfoRec;
  110. typedef PortInfoRec *PortInfoPtr;
  111.  
  112.  
  113. typedef PortInfoRec *PortInfoArrayPtr;
  114. typedef pascal Boolean (*PPCFilterProcPtr)(LocationNamePtr, PortInfoPtr);
  115. /*Procedures you will need to write 
  116.  ex: void MyCompletionRoutine(PPCParamBlkPtr pb) 
  117.  ex: pascal Boolean    MyPortFilter(LocationNamePtr locationName, PortInfoPtr 
  118.  thePortInfo)*/
  119.  
  120. typedef ProcPtr PPCCompProcPtr;
  121. #define PPCHeader \
  122.      Ptr               qLink;                   /* PPC's Internal Use */\
  123.      unsigned short    csCode;                  /* Requested PPC command */\
  124.      unsigned short    intUse;                  /* Internal Use */\
  125.      Ptr               intUsePtr;               /* Internal Use */\
  126.      PPCCompProcPtr       ioCompletion;         /* Completion Routine    */\
  127.      OSErr               ioResult;              /* Command Result Code */\
  128.      unsigned long       Reserved[5];           /* Reserved for PPC, Don't use */
  129.  
  130. struct PPCOpenPBRec {
  131.     PPCHeader 
  132.     PPCPortRefNum portRefNum;                   /* Port Reference */
  133.     long filler1;
  134.     PPCServiceType serviceType;                 /*  Bit field describing the requested port service    */
  135.     unsigned char resFlag;                      /* Must be set to 0 */
  136.     PPCPortPtr portName;                        /* PortName for PPC */
  137.     LocationNamePtr locationName;               /* If NBP Registration is required */
  138.     Boolean networkVisible;                     /* make this network visible on network */
  139.     Boolean nbpRegistered;                      /* The given location name was registered on the network */
  140. };
  141.  
  142. typedef struct PPCOpenPBRec PPCOpenPBRec;
  143. typedef PPCOpenPBRec *PPCOpenPBPtr;
  144.  
  145. struct PPCInformPBRec {
  146.  PPCHeader
  147.  PPCPortRefNum portRefNum;
  148.     PPCSessRefNum sessRefNum;
  149.     PPCServiceType serviceType;
  150.     Boolean autoAccept;
  151.     PPCPortPtr portName;
  152.     LocationNamePtr locationName;
  153.     StringPtr userName;
  154.     unsigned long userData;
  155.     PPCSessionOrigin requestType;
  156. };
  157.  
  158. typedef struct PPCInformPBRec PPCInformPBRec;
  159. typedef PPCInformPBRec *PPCInformPBPtr;
  160.  
  161. struct PPCStartPBRec {
  162.  PPCHeader
  163.     PPCPortRefNum portRefNum;
  164.     PPCSessRefNum sessRefNum;
  165.     PPCServiceType serviceType;
  166.     unsigned char resFlag;
  167.     PPCPortPtr portName;
  168.     LocationNamePtr locationName;
  169.     unsigned long rejectInfo;
  170.     unsigned long userData;
  171.     unsigned long userRefNum;
  172. };
  173.  
  174. typedef struct PPCStartPBRec PPCStartPBRec;
  175. typedef PPCStartPBRec *PPCStartPBPtr;
  176.  
  177. struct PPCAcceptPBRec {
  178.  PPCHeader
  179.     short filler1;
  180.     PPCSessRefNum sessRefNum;
  181. };
  182.  
  183. typedef struct PPCAcceptPBRec PPCAcceptPBRec;
  184. typedef PPCAcceptPBRec *PPCAcceptPBPtr;
  185.  
  186. struct PPCRejectPBRec {
  187.  PPCHeader
  188.     short filler1;
  189.     PPCSessRefNum sessRefNum;
  190.     short filler2;
  191.     long filler3;
  192.     long filler4;
  193.     unsigned long rejectInfo;
  194. };
  195.  
  196. typedef struct PPCRejectPBRec PPCRejectPBRec;
  197. typedef PPCRejectPBRec *PPCRejectPBPtr;
  198.  
  199. struct PPCWritePBRec {
  200.  PPCHeader
  201.     short filler1;
  202.     PPCSessRefNum sessRefNum;
  203.     Size bufferLength;
  204.     Size actualLength;
  205.     Ptr bufferPtr;
  206.     Boolean more;
  207.     unsigned char filler2;
  208.     unsigned long userData;
  209.     OSType blockCreator;
  210.     OSType blockType;
  211. };
  212.  
  213. typedef struct PPCWritePBRec PPCWritePBRec;
  214. typedef PPCWritePBRec *PPCWritePBPtr;
  215.  
  216. struct PPCReadPBRec {
  217.  PPCHeader
  218.     short filler1;
  219.     PPCSessRefNum sessRefNum;
  220.     Size bufferLength;
  221.     Size actualLength;
  222.     Ptr bufferPtr;
  223.     Boolean more;
  224.     unsigned char filler2;
  225.     unsigned long userData;
  226.     OSType blockCreator;
  227.     OSType blockType;
  228. };
  229.  
  230. typedef struct PPCReadPBRec PPCReadPBRec;
  231. typedef PPCReadPBRec *PPCReadPBPtr;
  232.  
  233. struct PPCEndPBRec {
  234.  PPCHeader
  235.     short filler1;
  236.     PPCSessRefNum sessRefNum;
  237. };
  238.  
  239. typedef struct PPCEndPBRec PPCEndPBRec;
  240. typedef PPCEndPBRec *PPCEndPBPtr;
  241.  
  242. struct PPCClosePBRec {
  243.  PPCHeader
  244.     PPCPortRefNum portRefNum;
  245. };
  246.  
  247. typedef struct PPCClosePBRec PPCClosePBRec;
  248. typedef PPCClosePBRec *PPCClosePBPtr;
  249.  
  250. struct IPCListPortsPBRec {
  251.  PPCHeader
  252.     short filler1;
  253.     unsigned short startIndex;
  254.     unsigned short requestCount;
  255.     unsigned short actualCount;
  256.     PPCPortPtr portName;
  257.     LocationNamePtr locationName;
  258.     PortInfoArrayPtr bufferPtr;
  259. };
  260.  
  261. typedef struct IPCListPortsPBRec IPCListPortsPBRec;
  262. typedef IPCListPortsPBRec *IPCListPortsPBPtr;
  263.  
  264. union PPCParamBlockRec
  265. {
  266.         PPCOpenPBRec        openParam;
  267.         PPCInformPBRec           informParam;
  268.         PPCStartPBRec        startParam;
  269.         PPCAcceptPBRec         acceptParam;
  270.         PPCRejectPBRec         rejectParam;
  271.         PPCWritePBRec        writeParam;
  272.         PPCReadPBRec        readParam;
  273.         PPCEndPBRec              endParam;
  274.         PPCClosePBRec        closeParam;
  275.         IPCListPortsPBRec    listPortsParam;
  276. };
  277. typedef union PPCParamBlockRec PPCParamBlockRec;
  278. typedef  PPCParamBlockRec  *PPCParamBlockPtr;
  279.  
  280.  
  281. /* selector codes for ppcsync and ppcasync */
  282.  
  283. #define PPCOpen            1
  284. #define PPCStart        2
  285. #define PPCInform        3
  286. #define PPCAccept        4
  287. #define PPCReject        5
  288. #define PPCWrite        6
  289. #define PPCRead            7
  290. #define PPCEnd            8
  291. #define PPCClose        9
  292. #define IPCListPorts    10
  293.  
  294. pascal OSErr PPCBrowser(Str255 *prompt,
  295.                         Str255 *applListLabel,
  296.                         Boolean defaultSpecified,
  297.                         LocationNameRec *theLocation,
  298.                         PortInfoRec *thePortInfo,
  299.                         PPCFilterProcPtr portFilter,
  300.                         Str32 *theLocNBPType);
  301.  
  302. #endif
  303.  
  304.